﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using ExamDemo.Models;

namespace ExamDemo.Data
{
    public class DataInitlizer : DropCreateDatabaseIfModelChanges<DemoDb>
    {
        protected override void Seed(DemoDb db)
        {

            db.Users.AddRange(new List<Users>
            {
                new Users
                {
                    UserName = "小小花",
                    PassWord="111"
                },
                new Users
                {
                    UserName = "小黄",
                    PassWord="222"
                },
                new Users
                {
                    UserName = "小红",
                    PassWord="123"
                },
                new Users
                {
                    UserName = "戴维斯",
                    PassWord="root"
                },
                new Users
                {
                    UserName = "韦德",
                    PassWord="12223"
                },
                new Users
                {
                    UserName = "詹姆斯",
                    PassWord="2223"
                },
                new Users
                {
                    UserName = "小黑",
                    PassWord="32432"
                }
            });

            db.Messages.AddRange(new List<Messages>
            {
                new Messages
                {
                    FromUserId = 1,
                    Content="那就是他呀"
                },
                new Messages
                {
                    FromUserId = 3,
                    Content="你怎么知道的"
                },
                new Messages
                {
                    FromUserId = 2,
                    Content="小花告诉我的呀"
                },
                new Messages
                {
                    FromUserId = 5,
                    Content="我只想见你"
                },
                new Messages
                {
                    FromUserId = 4,
                    Content="这家伙好"
                },
                new Messages
                {
                    FromUserId = 6,
                    Content="我也是怎么觉得"
                },
            });

            db.Comments.AddRange(new List<Comments>
            {
                new Comments
                {
                    FromUserId = 2,
                    MsgId=1,
                    Comment="今天比赛有四千万人看"
                },
                new Comments
                {
                    FromUserId = 1,
                    MsgId=1,
                    Comment="好家伙，太厉害了"
                },
                new Comments
                {
                    FromUserId = 4,
                    MsgId=2,
                    Comment="今天比赛比分100-103"
                },
                new Comments
                {
                    FromUserId = 3,
                    MsgId=2,
                    Comment="老胡队赢了"
                },
                new Comments
                {
                    FromUserId = 1,
                    MsgId=4,
                    Comment="老湖准绝杀"
                },
                new Comments
                {
                    FromUserId = 2,
                    MsgId=3,
                    Comment="太过分了"
                },
            });


            db.SaveChanges();
            base.Seed(db);
        }
    }
}